<?php

//////////////////////////////////////////////////////
// GPAC Database is Copyright 2002 Colin Todd       //
// Written by Colin Todd - All rights reserved.     //
//                                                  //
// colintodd@myfastmail.com                         //
//////////////////////////////////////////////////////

$alphabet = @$_GET['alphabet'];

$result = mysql_query("SELECT * FROM ".$PACTS_cfg->individualtablename." WHERE Surname LIKE '".$alphabet."%' ORDER BY Surname",$PACTS_cfg->dblink);

echo '<div id="page_header">'."\n";
echo '<ul>'."\n";
echo '<li class="titlename2">Reports Overview</li>'."\n";

echo '</ul>'."\n";
echo '</div>'."\n";

echo '<div id="details-section">'."\n";
echo '<div id="viewDetailsC1">'."\n";



$dir = "_content/_reports";
$count =0;
$opened_file = opendir($dir);
while ( $file = readdir($opened_file) ) {
    if ( $file != "." && $file != ".." && substr($file, strlen($file)-4, 4) == ".php") {
        if ($count==0){
            echo '<ul class="ReportOverview">'."\n";
        }

        if (($count % 3)==0 && $count!=0)
        {
            echo '</ul>'."\n";
            echo '<ul class="ReportOverview">'."\n";

        }
//build php page to get image for report.
//if images does not exist, use default image

        echo '<li class="colw33pc">'."\n";
        echo '<a href="index.php?view=Reports_filter&amp;ReportToFilter='.substr($file,0, strlen($file)-4).'" >'."\n";
        echo '<img class="ReportImage" src="index.php?view=display_image_thumb&amp;IndividualId=120&amp;width=150&amp;ReportImage='.substr($file,0, strlen($file)-4).'" alt="'.substr($file,0, strlen($file)-4).' Report"/>'."\n";
        echo '</a>'."\n";
        echo  '<br />'."\n";
        echo '<a href="index.php?view=Reports_filter&amp;ReportToFilter='.substr($file,0, strlen($file)-4).'" >'."\n";
        echo substr($file,0, strlen($file)-4)."\n";
        echo '</a>'."\n";
        echo '</li>'."\n";


        $count++;
    }
}
if ($count > 0){
    echo '</ul>'."\n";

}

closedir($opened_file);

echo '</div>'."\n";
echo '</div>'."\n";
?>